// Copyright 2011 Jefferson Willian
// willmont7@gmail.com

#include <cstdio>

#define MAX 10000

int main() {
  int n, itv;
  int in[MAX];
  int sum;
  int higher;
  int lower;
  int games = 1;

  while (scanf("%d%d", &n, &itv) && n !=0 || itv != 0) {
    for (int i = 0;i < n;i++)
      scanf("%d", &in[i]);

    sum = 0;

    for (int i = 0;i < itv;i++)
      sum += in[i];

    higher = sum/itv;
    lower = sum/itv;

    for (int i = itv;i < n;i++) {
      sum -= in[i-itv];
      sum += in[i];
      if (sum/itv < lower)
        lower = sum/itv;
      if (sum/itv > higher)
        higher = sum/itv;
    }

    printf("Teste %d\n%d %d\n\n", games++, lower, higher);
  }

  return 0;
}
